package com.tamo.ppresta.util;

import org.greenrobot.eventbus.EventBus;

/**
 * @author yeyang
 * @name ppresta
 * @class name：com.tamo.ppresta.util
 * @class describe
 * @time 2022/12/18 14:28
 * @change
 * @chang time
 * @class describe
 */
public class EventBusUtil {
    /**
     * EventBus 注册
     * @param subscriber
     */
    public static void register(Object subscriber) {
        EventBus.getDefault().register(subscriber);
    }

    /**
     * 取消注册或反注册
     * @param subscriber
     */
    public static void unregister(Object subscriber) {
        EventBus.getDefault().unregister(subscriber);
    }

    /**
     * 发送数据
     * @param event
     */
    public static void sendEvent(Event event) {
        EventBus.getDefault().post(event);
    }

    /**
     * 发送粘性事件数据
     * @param event
     */
    public static void sendStickyEvent(Event event) {
        EventBus.getDefault().postSticky(event);
    }
} 